package com.qhgrain.app.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import com.paas.base.modules.utils.lang.StringUtil;
import com.paas.base.modules.utils.page.PageBean;
import com.pubframework.common.util.Props;
import com.qhgrain.app.service.UserAppsService;
import com.qhgrain.app.util.ControllerUtil;
import com.qhgrain.app.vo.UserAppsVo;

@Controller
@RequestMapping("/userapps")
public class UserAppsController {

private static Logger LOG = LoggerFactory.getLogger(UserAppsController.class);
	
	
	@Autowired
	private UserAppsService userAppsService;
	
	@RequestMapping(value="/list")
	public String list(){
		
		return "userapps/userapps_list";
	}
	
	@RequestMapping(value="/list/table")
	public String queryUserAppsForTable(HttpServletRequest request,Model model,String userName,String roleName,String appName,String pageNo,String pageSize){
		
		if(StringUtils.isEmpty(pageNo)){
			pageNo="1";
		}
		if(StringUtil.isBlank(pageSize)){
			pageSize = "10";
		}
		
		PageBean<UserAppsVo> pageBean = this.userAppsService.queryList(userName, roleName, appName, pageNo, pageSize);
		model.addAttribute("pageBean", pageBean);
		return "userapps/userapps_list_table";
	}
}
